<template>
  <div class="user">
    <div class="header">
      <img
        @click="haha"
        src="https://mall.s.maizuo.com/343e03528520399b9de18b164d980d1f.jpg"
        alt=""
      />

      <span>欢迎您~{{ user }}</span>
    </div>
    <van-notice-bar
      left-icon="volume-o"
      text="各位尊敬的业主，您好！本月物业费已开始收取，请注意缴费~"
    />
    <van-grid :column-num="3">
      <van-grid-item icon="home-o" text="搜索" dot />
      <van-grid-item icon="search" text="团购" badge="99+" />
      <van-grid-item
        icon="search"
        text="我的订单"
        dot
        :to="{ name: 'Order' }"
      />
    </van-grid>
  
      <van-index-anchor   />
      <van-cell style="font-size:25px" title="公  告" :to="{ name: 'Gong' }"/>
      <van-cell style="font-size:25px" title="资  讯" :to="{ name: 'Categroy' }"/>
      <van-cell style="font-size:25px" title="论  坛" :to="{ name: 'Fornum' }"/>
      

  </div>
</template>

<script>
// import { orderdetail } from "../services/order";

export default {
  data() {
    return {
      user: "",
      list: "",
    };
  },
  methods: {
    haha() {
      if (this.user == "立即登录") {
        this.$router.push({
          name: "Login",
        });
      } else {
        localStorage.removeItem("loginPhone");
        localStorage.removeItem("token");
      }
    },
  },
  async created() {
    if (localStorage.getItem("loginPhone")) {
      const newphone = localStorage.getItem("loginPhone");
      console.log(newphone);
      this.user = JSON.parse(newphone);
      console.log(this.user);
    } else {
      this.user = "立即登录";
    }
  },
};
</script>

<style>
.header {
  background: url("https://assets.maizuo.com/h5/v5/public/app/img/bg.6837f67.png")
    0 -0.3rem;
  background-size: cover;
  margin-top: -44px;
  height: 136px;
  padding-left: 22px;
  padding-top: 64px;
  display: flex;
  align-items: center;
}
.header img {
  width: 63px;
  height: 63px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  /* margin: 0 auto; */
}
.gonggao {
  width: 100px;
}
.cart1 {
  width: 100%;
}
.cart1 span {
  width: 100%;
  height: 50rem;
  background-color: grey;
}
</style>